<?php /*a:3:{s:61:"D:\phpStudy\WWW\tp5\application\index\view\lab\lab_empty.html";i:1553441788;s:60:"D:\phpStudy\WWW\tp5\application\index\view\index\header.html";i:1550326364;s:60:"D:\phpStudy\WWW\tp5\application\index\view\index\footer.html";i:1550326435;}*/ ?>
 <!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>广州商学院lms</title>
    <link rel="stylesheet" href="/static/css/xadmin.css">
    <script type="text/javascript" src="/static/lib/layui/layui.js"></script>
    <script type="text/javascript" src="/static/js/jquery.js"></script>
    <link rel="stylesheet" type="text/css" href="/static/lib/layui/css/layui.css" />
    <style>
        body{
            background: #F7F7F7;
        }
       
    </style>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">广州商学院-lms</div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item"><a href="<?php echo url('index'); ?>">首页</a></li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <?php if(app('session')->get('user')): ?>
                <a href="javascript:;">
                    <?php if(app('session')->get('user.img')): ?>
                    <img src="/uploads/<?php echo htmlentities(app('session')->get('user.img')); ?>" class="layui-nav-img">
                    <?php else: ?>
                    <img src="/static/img/头像默认.png" class="layui-nav-img">
                    <?php endif; ?>
                    <?php echo htmlentities(app('session')->get('user')->userinfo->realname); ?>
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="">基本资料</a></dd>
                    <dd><a href="">切换账号</a></dd>
                </dl>
                <?php else: ?>
                <a href="<?php echo url('login'); ?>">登录</a>
                <?php endif; ?>
            </li>
            <li class="layui-nav-item">
                <?php if(app('session')->get('user')): ?>
                <a href="<?php echo url('logout'); ?>">注销</a>
                <?php else: ?>
                <a href="<?php echo url('regist'); ?>">注册</a>
                <?php endif; ?>
            </li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <li id="lab_app" class="layui-nav-item">
                    <a class=""  href="javascript:;">实验室预约</a>
                    <dl class="layui-nav-child">
                        <dd><a href="<?php echo url('lab_empty'); ?>">空实验室</a></dd>
                        <!--<dd><a href="javascript:;">列表二</a></dd>-->
                    </dl>
                </li>
                <li id="tool_app" class="layui-nav-item">
                    <a href="javascript:;">器具租借</a>
                    <dl class="layui-nav-child">
                        <dd><a href="<?php echo url('tool_small_app'); ?>">小型器具借用申请</a></dd>
                        <dd><a href="<?php echo url('tool_big_app'); ?>">大型器具借用申请</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item" id="lab_yuyue">
                    <a href="javascript:;">预约进度</a>
                    <dl class="layui-nav-child">
                        <dd id="now_yuyue"><a href="<?php echo url('lab_app_list'); ?>">课室当前预约</a></dd>
                        <dd id="old_yuyue"><a href="<?php echo url('lab_history_list'); ?>">课室历史预约</a></dd>
                        <dd id="tool_yuyue"><a href="<?php echo url('tool_list'); ?>">器具借用进度</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item" id="teacher_list"><a href="<?php echo url('teacher_list'); ?>">联系教师</a></li>
                <li class="layui-nav-item" id="notice"><a href="<?php echo url('notice'); ?>">公告消息</a></li>
                <li class="layui-nav-item" id="feedback"><a href="<?php echo url('feedback'); ?>">问题反馈</a></li>
                <li class="layui-nav-item" id="about_me"><a href="<?php echo url('about_me'); ?>">关于我的</a></li>
            </ul>
        </div>
    </div>

    <div class="layui-body">

<div style="padding:20px; ">
    <div style="background: #FFFFFF;padding: 20px 50px;">
        <div style="margin: 10px 0px;">
        <span class="layui-breadcrumb">
  <a href="">首页</a>
  <a href="">实验室预约</a>
  <a><cite>空实验室</cite></a>
</span>
        </div>
            <div class="layui-row">
                <form class="layui-form " method="get" action="">
                    <div class="layui-form-item">
                        <div class="layui-input-inline">
                            <input type="text" id="test2" name="date"  placeholder="请选择时间"  class="layui-input" value="<?php echo htmlentities($date); ?>">
                        </div>
                        <div class="layui-input-inline">
                            <select name="time" lay-verify="required">
                                <option value="">请选择时间段</option>
                                <?php if($time == '08:20-09:50'): ?>
                                <option value="08:20-09:50" selected="selected">08:20-09:50</option>
                                <?php else: ?>
                                <option value="08:20-09:50">08:20-09:50</option>
                                <?php endif; if($time == '10:10-11:40'): ?>
                                <option value="10:10-11:40" selected="selected">10:10-11:40</option>
                                <?php else: ?>
                                <option value="10:10-11:40">10:10-11:40</option>
                                <?php endif; if($time == '14:30-16:00'): ?>
                                <option value="14:30-16:00" selected="selected">14:30-16:00</option>
                                <?php else: ?>
                                <option value="14:30-16:00">14:30-16:00</option>
                                <?php endif; if($time == '16:00-17:50'): ?>
                                <option value="16:00-17:50" selected="selected">16:00-17:50</option>
                                <?php else: ?>
                                <option value="16:00-17:50">16:00-17:50</option>
                                <?php endif; ?>
                            </select>
                        </div>
                        <button class="layui-btn" type="submit"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
                    </div>

                </form>
            </div>

            <table class="layui-table">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>课室名称</th>
                    <th>所在地址</th>
                    <th>承载人数</th>
                    <th>管理教师</th>
                    <th>操作</th>
                </thead>
                <tbody>
                <?php if(is_array($labs) || $labs instanceof \think\Collection || $labs instanceof \think\Paginator): $i = 0; $__LIST__ = $labs;if( count($__LIST__)==0 ) : echo "$empty" ;else: foreach($__LIST__ as $key=>$lab): $mod = ($i % 2 );++$i;?>
                <tr>
                    <td><?php echo htmlentities($lab['id']); ?></td>
                    <td><?php echo htmlentities($lab['name']); ?></td>
                    <td><?php echo htmlentities($lab['address']); ?></td>
                    <td><?php echo htmlentities($lab['people']); ?></td>
                    <td>
                        <?php if($lab['teacher_id']): ?>
                        <?php echo htmlentities((isset($lab->teacher->realname) && ($lab->teacher->realname !== '')?$lab->teacher->realname:"暂无教师信息")); else: ?>
                        暂无管理教师
                        <?php endif; ?>
                    </td>
                    <td>
                        <a title="申请预约" onclick="lab_app(this,'<?php echo htmlentities($lab['id']); ?>')" href="javascript:;">
                            <!--<i class="layui-icon">&#xe640;</i>-->
                            申请预约
                        </a>
                    </td>
                </tr>
                <?php endforeach; endif; else: echo "$empty" ;endif; ?>
                </tbody>
            </table>
        <input type="hidden" value="<?php echo htmlentities($date); ?>" id="date">
        <input type="hidden" value="<?php echo htmlentities($time); ?>" id="time">
        <?php if($date): ?>
        <div class="page">
            <?php echo $labs; ?>
        </div>
        <?php else: ?>
        <?php endif; ?>
    </div>
</div>

<div class="layui-footer">
    <!-- 底部固定区域 -->
    Copyright-2018-实验室管理系统网
</div>
</div>
<script>
    //JavaScript代码区域
    layui.use('element', function() {
        var element = layui.element;

    });
</script>
</body>
</html>

<script>
    $('#lab_app').addClass("layui-nav-itemed");
    layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#test2' //指定元素
        });
    });
    layui.use('form', function(){
        var form = layui.form;
        //监听提交
        form.on('submit(formDemo)', function(data){
            layer.msg(JSON.stringify(data.field));
            return false;
        });
    });
    function lab_app(obj,id) {
        var ii=layer.load();
        $.post(
            "<?php echo url('lab_app'); ?>",
            {
                lab_id:id,
                date:$('#date').val(),
                time:$('#time').val(),
            },
            function (data) {
                if (data.statu==200){
                    layer.close(ii);
                    layer.msg(data.msg,function () {
                        window.location.href="<?php echo url('lab/lab_app_list'); ?>"
                    })
                } else {
                    layer.close(ii);
                    layer.msg(data.msg)
                }
            }
        )
    }
</script>

